from random import randint

import matplotlib.pyplot as plt
import numpy as np

plt.rcParams['font.family'] = 'SimHei'
plt.rcParams['font.size'] = 12

x = np.arange(120)
y1 = [randint(20, 35) for i in np.arange(120)]
y2 = [randint(20, 35) for j in np.arange(120)]

fig = plt.figure('Line Chart', figsize=(16, 8))

plt.title('随机气温折线图', size=24)
plt.xlabel('时间')
plt.ylabel('气温(°C)')
plt.xticks(np.arange(0, 120, 10), [f'{h}点{m}分' for h in np.arange(10, 12) for m in np.arange(0, 60, 10)], rotation=45)

plt.plot(x, y1, label='y1')
plt.plot(x, y2, label='y2')

plt.legend(loc='best')
plt.grid()
plt.show()
